home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Panorama / Panorama - Disk 01 (1986-02-15)(Pacific North-West Amigas Club)[h AFL][b corrupt files].zip / Panorama - Disk 01 (1986-02-15)(Pacific North-West Amigas Club)[h AFL][b corrupt files].adf / mand4.c < prev    next >
Text File  |  1989-10-24  |  13KB  |  289 lines

  1. /* ***************************************************************************
  2.  *                     MAND4.C - Information
  3.  *             Mandelbrot Self-Squared Dragon Generator
  4.  *                    For the Commodore Amiga
  5.  *                         Version 2.01
  6.  *
  7.  *              Copyright (C) 1986,  =Robert J. Mical=
  8.  *                   Placed in the Public Domain
  9.  *
  10.  *
  11.  *   This program may be distributed free of charge as long as the above
  12.  *                         notice is retained.
  13.  *
  14.  ************************************************************************** */
  15.  
  16. /* === IMPORTANT NOTE: =================================================
  17.  *   If you are going to design Information pages, make sure that all
  18.  *   lines are a maximum of 59 characters long.  Also, make sure that
  19.  *   there are 19 lines at most per page.  These two restrictions
  20.  *   are to allow info pages to fit on low-res fat font screens.
  21.  *   These two restrictions combined comprise the reason why the info 
  22.  *   pages are (and should remain) terse.
  23.  * ===================================================================== */
  24.  
  25.  
  26. #include "mand.h"
  27.  
  28. extern SHORT Color0, Color1, Color2;
  29. extern SHORT UserPalette[29];
  30.  
  31. extern FILE *console;
  32. extern float cnvf();
  33.  
  34. extern union kludge {
  35.    float f;
  36.    int i;
  37. } start_r,end_r,start_i,end_i;  /* Block bounds for set */
  38. extern int max_x,max_y,max_mem_y;  /* Graphics window size */
  39. extern int max_count,color_inc,color_offset,color_set,color_mode,color_div;
  40. extern int color_inset,func_num;
  41.  
  42. extern int v_starty,max_mem;
  43. extern long v_offset;
  44. extern UWORD *color_table,*v_mand_store;
  45.  
  46.  
  47. Information(page)
  48. SHORT page;
  49. {
  50.    FILE *c;
  51.  
  52.    c = console;
  53.  
  54.    switch (page) {
  55.  
  56. case 0:
  57. case 1:
  58. fprintf(c, "Mandelbrot Self-Squared Dragon Generator Version %s\n", VERSION);
  59. fputs("Copyright (C) 1985 - Robert S. French\n",c);
  60. fputs("Vastly Enhanced (with Intuition!) by  =RJ Mical=  1985/86\n",c);
  61. fputs("Copyright (C) 1986 - =Robert J. Mical= -\n",c);
  62. fputs("Placed in the public domain ... Please read and learn!\n",c);
  63. fputs("\n",c);
  64. fputs("Inspired by Scientific American, August/1985\n",c);
  65. fputs("Corrections and improvements suggested by\n",c);
  66. fputs("\"The Fractal Geometry of Nature\"\n",c);
  67. fputs("By Benoit Mandelbrot, W.H. Freeman and Company, 1983\n",c);
  68. fputs("(Used to be Z=Z^2+C, now is Z=Z^2-u, etc.)\n",c);
  69. fputs("\n",c);
  70. fputs("Robert S. French may be contacted at:\n",c);
  71. fputs("   USPS:   2740 Frankfort Avenue\n",c);
  72. fputs("           Louisville, Ky  40206\n",c);
  73. fputs("   Phone: (502) 897-5096   ARPA: French#Robert%d@LLL-MFE\n",c);
  74. break;
  75.  
  76. case 2:
  77. fputs("The four basic commands of this program are:\n",c);
  78. fputs("G  - Generate picture\n",c);
  79. fputs("   When this command is entered the Mandelbrot set is drawn\n",c);
  80. fputs("   according to the current settings.  When you first run\n",c);
  81. fputs("   this program, you can say \"G\" immediately and see \n",c);
  82. fputs("   the entire Mandelbrot set.\n",c);
  83. fputs("\n",c);
  84. fputs("SH   - Show current settings\n",c);
  85. fputs("   When you enter the command \"SH\", the current settings of\n",c);
  86. fputs("   all of the important variables are shown.  To reproduce\n",c);
  87. fputs("   a picture, you should copy these values down so you or\n",c);
  88. fputs("   anyone else can re-enter the values and re-generate\n",c);
  89. fputs("   the picture.\n",c);
  90. fputs("\n",c);
  91. fputs("I n  - Information pages\n",c);
  92. fputs("   Shows page n of the information pages.\n",c);
  93. fputs("\n",c);
  94. fputs("Q  - Quit\n",c);
  95. fputs("   Lets you exit back to the Workbench or CLI.\n",c);
  96. break;
  97.  
  98.  
  99. case 3:
  100. fputs("The Mandelbrot set consists of pairs of numbers, one number\n",c);
  101. fputs("real and the other complex.  This set can be graphed using\n",c);
  102. fputs("one axis for the real numbers and the other for the complex\n",c);
  103. fputs("numbers.  The Mandelbrot set is located on a graph roughly\n",c);
  104. fputs("centered over the origin (0,0).  The default settings of\n",c);
  105. fputs("this program create a display that shows the entire set.\n",c);
  106. fputs("All of the black display pixels represent Mandelbrot pairs.\n",c);
  107. fputs("The shaded pixels show the pairs that are *almost* in the\n",c);
  108. fputs("set.  The pairs nearest the set on the display just miss\n",c);
  109. fputs("making it into the set numerically; these are white.  The\n",c);
  110. fputs("more grey a position, the further the pair is from the set.\n",c);
  111. fputs("    This program lets you explore the Mandelbrot set by\n",c);
  112. fputs("panning across and zooming in to look at details of the set.\n",c);
  113. fputs("You can also change colors and display mode.  For instance:\n",c);
  114. fputs(" : CS 1      ; Use the fancy arrangements of color set 1\n",c);
  115. fputs(" : CO 29     ; Set the initial color offset\n",c);
  116. fputs(" : CI 4      ; Set the color increment\n",c);
  117. fputs(" : MC 29     ; Set the maximum tests count\n",c);
  118. fputs(" : G         ; Generate the picture\n",c);
  119. break;
  120.  
  121.  
  122. case 4:
  123. fputs("The MC command lets you specify how many times each position\n",c);
  124. fputs("is tested to see whether or not it's in the Mandelbrot set.\n",c);
  125. fputs("A low MC value means that very few tests will be done on\n",c);
  126. fputs("position, which will cause the display to be created more\n",c);
  127. fputs("quickly, but which will also have a cruder approximation of\n",c);
  128. fputs("the Mandelbrot set and, consequently, fewer colors.\n",c);
  129. fputs("\n",c);
  130. fputs("The MX and MY commands set the size of the display window.\n",c);
  131. fputs("The larger your window, the longer it takes for the picture\n",c);
  132. fputs("to be resolved.  While you're experimenting with the\n",c);
  133. fputs("program, you should create a smaller window with a lower\n",c);
  134. fputs("count value until you get approximately the picture that you\n",c);
  135. fputs("want to see.  Then when you've gotten a picture you want to\n",c);
  136. fputs("see in large scale, increase the size and count resolution\n",c);
  137. fputs("to see the detailed version of your picture.  For instance:\n",c);
  138. fputs(" : MC 8        ; Each position will be tested only 8 times\n",c);
  139. fputs(" : MX 80       ; The width is 25% of full width\n",c);
  140. fputs(" : MY 50       ; The height is 25% of full height\n",c);
  141. fputs(" : G           ; Generate the picture\n",c);
  142. break;
  143.  
  144. case 5:
  145. fputs(" : CS 1        ; Color set 1 (special ranges of colors)\n",c);
  146. fputs(" : CI 1        ; Color increment of 1 (smallest increment)\n",c);
  147. fputs(" : MC 29       ; Count position and number of colors\n",c);
  148. fputs("Then, by setting the initial color offset into color set 1 \n",c);
  149. fputs("using the command CO, you can select from these ranges:\n",c);
  150. fputs("      ======    ===========================================\n",c);
  151. fputs("        1-15    unit steps of blue\n",c);
  152. fputs("       16-30    unit steps of green\n",c);
  153. fputs("       31-45    unit steps of red\n",c);
  154. fputs("       46-60    unit steps of sky sky blue (blue and green)\n",c);
  155. fputs("       61-75    unit steps of purple (blue and red)\n",c);
  156. fputs("       76-90    unit steps of yellow (red and green)\n",c);
  157. fputs("       91-115   unit steps of white (all colors)\n",c);
  158. fputs("CM is the command to set the display mode.  Add up these:\n",c);
  159. fputs("    o  add 1 to get NO HOLD-AND-MODIFY\n",c);
  160. fputs("    o  add 2 to get INTERLACE\n",c);
  161. fputs("    o  add 4 to get HIRES (640 columns; low-res is 320)\n",c);
  162. fputs("For instance, for HIRES and NO HOLD-AND-MODIFY, add 1 + 4:\n",c);
  163. fputs(" : CM 5\n",c);
  164. break;
  165.  
  166. case 6:
  167. fputs("The starting (left) and ending (right) edge values for the\n",c);
  168. fputs("axis of the real numbers (the horizontal axis) can be set\n",c);
  169. fputs("using the commands SR (Start Real) and ER (End Real).  For\n",c);
  170. fputs("the complex numbers axis (vertical) the start (bottom) and\n",c);
  171. fputs("end (top) edge values are set using SI and EI.  Got it?\n",c);
  172. fputs("    The graph that you get with this program's default\n",c);
  173. fputs("values has the real numbers along the horizontal axis.  The\n",c);
  174. fputs("leftmost position represents the real number -2.85.  The\n",c);
  175. fputs("rightmost position represents 2.85.  The complex numbers\n",c);
  176. fputs("are charted along the vertical axis, starting at the bottom\n",c);
  177. fputs("with a value of -2.05 and ranging up to 2.05 at the top.\n",c);
  178. fputs("    You control the range of these axes using the text\n",c);
  179. fputs("commands SR, ER, SI and EI.  The commands ZR and ZI let you\n",c);
  180. fputs("zoom in or out on the real and imaginary axes respectively.\n",c);
  181. fputs("ZB lets you zoom on both proportionally.\n",c);
  182. fputs("    Once the display is built, there are ZOOM menu commands\n",c);
  183. fputs("which allow you to zoom in and out automatically.  These\n",c);
  184. fputs("are more convenient than using the text commands.  On the\n",c);
  185. fputs("other hand, the text commands lend precision.\n",c);
  186. break;
  187.  
  188. case 7:
  189. fputs("OK!  Now there's plenty of new features, especially being\n", c);
  190. fputs("able to change the colors and save pictures to the disk.\n", c);
  191. fputs("I hope you find this newest version more useable.  -=RJM=-\n", c);
  192. fputs("\n", c);
  193. fputs("There's lots more to this program than what's described on\n",c);
  194. fputs("these info pages.  You should read the available text on\n",c);
  195. fputs("Mandelbrot sets (see info page 1).  This program has more \n",c);
  196. fputs("features than what's described here.  If you can get your\n",c);
  197. fputs("hands on the source, you're welcome to expand these pages.\n",c);
  198. fputs("In fact, this program is still far from complete.  Care to\n",c);
  199. fputs("have a bash at it?  We need the greater-precision \n",c);
  200. fputs("floating point.  Also, we seriously need to be able to\n",c);
  201. fputs("save some or all of the image to a disk file in IFF format.\n",c);
  202. fputs("\n",c);
  203. fputs("Good luck.  Have fun!  Send mail (on USENET at least!) if\n",c);
  204. fputs("you find spectacular scenes.\n",c);
  205. break;
  206.  
  207.  
  208. default:
  209. fputs("SORRY:  there's not that many pages of info available!\n",c);
  210. AvailableCommands();
  211. break;
  212.  
  213.    }
  214.  
  215. }
  216.  
  217.  
  218. AvailableCommands()
  219. {
  220.     FILE *c;
  221.  
  222.     c = console;
  223.  
  224. /* === TRY TO KEEP THIS PAGE 18 LINES TALL AT MOST ======================== */
  225. fputs("AVAILABLE COMMANDS:\n",c);
  226. fputs("SH   - Show current settings        G  - Generate picture\n",c);
  227. fputs("I n  - Information pages            Q  - Quit\n",c);
  228. fputs("\n",c);
  229. fputs("SR n / SI n / ER n / EI n - Starting and ending coords\n",c);
  230. fputs("MX n / MY n - x/y display size      MC n - Max exam count\n",c);
  231. fputs("XR n / XI n - Move to new coordinates\n",c);
  232. fputs("ZR n / ZI n / ZB n - Zoom around the center point\n",c);
  233. fputs("\n",c);
  234. fputs("CM n - Graphics mode                F n - Dragon function\n",c);
  235. fputs("CI n - Color increment              CD  - Color divisor\n",c);
  236. fputs("CO n - Color offset                 CS  - Color set\n",c);
  237. fputs("CT n - Color for points in set      P n - Start from Preset\n",c);
  238. fputs("\n",c);
  239. fputs("D  - Display picture                A  - Analyze\n",c);
  240. fputs("SA filename - Save set data         L name - Load set data\n",c);
  241. fputs("< filename - Redirect input         ; string - Comment\n",c);
  242. fprintf(c,"MM n - Maximum number of %d pixel lines in memory\n",MAXX);
  243.  
  244. }
  245.  
  246.  
  247. CurrentSettings()
  248. {
  249. SHORT i, c;
  250.  
  251. fprintf(console, "             Description  Command  Current Value\n");
  252. fprintf(console, "========================  =======  =============\n");
  253. fprintf(console, "       Start Real (Left)   SR n:   %f\n", cnvf(start_r.i));
  254. fprintf(console, "        End Real (Right)   ER n:   %f\n", cnvf(end_r.i));
  255. fprintf(console, "Start Imaginary (Bottom)   SI n:   %f\n", cnvf(start_i.i));
  256. fprintf(console, "     End Imaginary (Top)   EI n:   %f\n", cnvf(end_i.i));
  257. fputs("\n", console);
  258.  
  259. fprintf(console, "          Function Number   F n:   %d\n", func_num);
  260. fprintf(console, "   Max Examination Count   MC n:   %d\n", max_count);
  261. fprintf(console, "               Color Set   CS n:   %d\n", color_set);
  262. if (color_set < 2)
  263.   {
  264.   fprintf(console, "         Color Increment   CI n:   %d\n", color_inc);
  265.   fprintf(console, "            Color Offset   CO n:   %d\n", color_offset);
  266.   }
  267. else
  268.   for (i = 0; i < 32; i++)
  269.     {
  270.     if ((i % 6) == 0) fputs("Color ", console);
  271.  
  272.     switch (i)
  273.         {
  274.         case 0: c = Color0; break;
  275.         case 1: c = Color1; break;
  276.         case 2: c = Color2; break;
  277.         default: c = UserPalette[i - 3]; break;
  278.         }
  279.  
  280.     fprintf(console, "%d=%d,%d,%d ", i, (c>>8) & 0xF, (c>>4) & 0xF, c & 0xF);
  281.     if ((i % 6) == 5) fputs("\n", console);
  282.     }
  283.  
  284. fputs("\n", console);
  285. fprintf(console, "              Color Mode   CM n:   %d\n", color_mode);
  286. fprintf(console, "           Color Divisor   CD n:   %d\n", color_div);
  287. fprintf(console, "  Display Width/Height   MX/Y n:   %d %d\n", max_x, max_y);
  288. }
  289.